struct net_private *np;
int i, requeue_idx;
netif_tx_request_t *tx;
+ struct sk_buff *skb;
np = netdev_priv(dev);
spin_lock_irq(&np->tx_lock);
np->rx_resp_cons = np->tx_resp_cons = np->tx_full = 0;
np->rx->event = np->tx->event = 1;
- /* Step 2: Rebuild the RX and TX ring contents.
+ /*
+ * Step 2: Rebuild the RX and TX ring contents.
* NB. We could just free the queued TX packets now but we hope
* that sending them out might do some good. We have to rebuild
* the RX ring because some of our pages are currently flipped out
* them.
*/
- /* Rebuild the TX buffer freelist and the TX ring itself.
+ /*
+ * Rebuild the TX buffer freelist and the TX ring itself.
* NB. This reorders packets. We could keep more private state
* to avoid this but maybe it doesn't matter so much given the
* interface has been down.
*/
for (requeue_idx = 0, i = 1; i <= NETIF_TX_RING_SIZE; i++) {
- if ((unsigned long)np->tx_skbs[i] >= __PAGE_OFFSET) {
- struct sk_buff *skb = np->tx_skbs[i];
-
- tx = &np->tx->ring[requeue_idx++].req;
-
- tx->id = i;
- gnttab_grant_foreign_access_ref(
- np->grant_tx_ref[i], np->backend_id,
- virt_to_mfn(np->tx_skbs[i]->data),
- GNTMAP_readonly);
- tx->gref = np->grant_tx_ref[i];
- tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
- tx->size = skb->len;
-
- np->stats.tx_bytes += skb->len;
- np->stats.tx_packets++;
- }
+ if ((unsigned long)np->tx_skbs[i] < __PAGE_OFFSET)
+ continue;
+
+ skb = np->tx_skbs[i];
+
+ tx = &np->tx->ring[requeue_idx++].req;
+
+ tx->id = i;
+ gnttab_grant_foreign_access_ref(
+ np->grant_tx_ref[i], np->backend_id,
+ virt_to_mfn(np->tx_skbs[i]->data),
+ GNTMAP_readonly);
+ tx->gref = np->grant_tx_ref[i];
+ tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
+ tx->size = skb->len;
+ tx->csum_blank = (skb->ip_summed == CHECKSUM_HW);
+
+ np->stats.tx_bytes += skb->len;
+ np->stats.tx_packets++;
}
wmb();
np->tx->req_prod = requeue_idx;
/* Rebuild the RX buffer freelist and the RX ring itself. */
for (requeue_idx = 0, i = 1; i <= NETIF_RX_RING_SIZE; i++) {
- if ((unsigned long)np->rx_skbs[i] >= __PAGE_OFFSET) {
- gnttab_grant_foreign_transfer_ref(
- np->grant_rx_ref[i], np->backend_id);
- np->rx->ring[requeue_idx].req.gref =
- np->grant_rx_ref[i];
- np->rx->ring[requeue_idx].req.id = i;
- requeue_idx++;
- }
+ if ((unsigned long)np->rx_skbs[i] < __PAGE_OFFSET)
+ continue;
+ gnttab_grant_foreign_transfer_ref(
+ np->grant_rx_ref[i], np->backend_id);
+ np->rx->ring[requeue_idx].req.gref =
+ np->grant_rx_ref[i];
+ np->rx->ring[requeue_idx].req.id = i;
+ requeue_idx++;
}
-
wmb();
np->rx->req_prod = requeue_idx;
- /* Step 3: All public and private state should now be sane. Get
+ /*
+ * Step 3: All public and private state should now be sane. Get
* ready to start sending and receiving packets and give the driver
* domain a kick because we've probably just requeued some
* packets.
#endif
}
-/* Move the vif into connected state.
+/*
+ * Move the vif into connected state.
* Sets the mac and event channel from the message.
* Binds the irq to the event channel.
*/
info->evtchn = 0;
}
-/* Stop network device and free tx/rx queues and irq.
- */
+/* Stop network device and free tx/rx queues and irq. */
static void shutdown_device(struct net_private *np)
{
/* Stop old i/f to prevent errors whilst we rebuild the state. */
return err;
}
-/* Setup supplies the backend dir, virtual device.
-
- We place an event channel and shared frame entries.
- We watch backend to wait if it's ok. */
+/*
+ * Setup supplies the backend dir, virtual device.
+ * We place an event channel and shared frame entries.
+ * We watch backend to wait if it's ok.
+ */
static int netfront_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{